<?php

//UMA new
namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class InputItem extends JsonResource
{
    /**
     * 把 model 转换成 array.
     * model 変換 array
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'name' => $this->input_item,
            'input_name' => $this->identifier,
            //'input_type' => $this->input_type,
            'options' => $this->when($this->options->isNotEmpty(), InputOption::collection($this->options)),
        ];
    }
}
